﻿using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using GFE.SharePoint;
using GFE.SharePoint.Lazy;
using GFE.Interfaces.Sample.Supervisors;
using GFE.Webpart.Sample.ControlTemplates.GFE.Webpart.Sample;

namespace GFE.Webpart.Sample.Views.CustomerListWebpart
{
    [ToolboxItemAttribute(false)]
    public class CustomerListWebpart : WebPart
    {
        protected override void CreateChildControls()
        {
            var CustomerListSupervisor = GFECompositionContainer.GetExport<ICustomerListWebpartSupervisor>().AsGFEMVPLazy();
            CustomerListSupervisor.OnLoad += CustomerListWebpart_Loaded;
            CustomerListSupervisor.InvokeView(this);
        }

        void CustomerListWebpart_Loaded(ref Control LoadedControl)
        {
            var searchControl = LoadedControl as CustomerListControl;
            //
            // Do initial stuff... 
            //
        }
    }
}
